﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ArtemisTest
{
    public abstract class CSystem
    {
        EntitySystem _entitySystem;         //Provides access to all other components
        ScriptSystem _scriptSystem;         //Provides access to event notifications

        /// <summary>Does the class exist</summary>
        protected bool Exists(Component c) { return c != null; }

        protected EntitySystem EntitySystem { get { return _entitySystem; } }

        public abstract void Init();

        public abstract void PreUpdate(double dt);

        public abstract void Update(double dt);

        public abstract void PostUpdate(double dt);

        /// <summary>Sends an event to ScriptSystem and then it is sent to every script with "tag"</summary>
        public void SendSignal(ScriptEvent args) { _scriptSystem.HandleEvent(args); }

        public CSystem(EntitySystem es, ScriptSystem ss)
        {
            _entitySystem = es;
            _scriptSystem = ss;
        }

    }
}
